﻿namespace PhotobucketNet
{
    using System.Collections.Generic;
    using System.Xml;

    public class AlbumList : List<Album>
    {
        internal static AlbumList CreateFromXmlDocument(XmlDocument document)
        {
            return CreateFromXmlNodeList(document.SelectNodes("descendant::media"));
        }

        internal static AlbumList CreateFromXmlNodeList(XmlNodeList albumNodeList)
        {
            AlbumList list = new AlbumList();
            foreach (XmlNode node in albumNodeList)
            {
                list.Add(Album.CreateFromXmlNode(node));
            }
            return list;
        }

        internal static AlbumList CreateFromXmlResponseMessage(XmlResponseMessage responseMessage)
        {
            return CreateFromXmlDocument(responseMessage.ResponseXml);
        }
    }
}

